JavaScript
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const sqlBatchResultView = await client.axons.sql.batch('id', { statements: [{ sql: 'sql' }] });
console.log(sqlBatchResultView.results);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
sql_batch_result_view = client.axons.sql.batch(
id="id",
statements=[{
"sql": "sql"
}],
)
print(sql_batch_result_view.results)curl --request POST \
--url https://api.runloop.ai/v1/axons/{id}/sql/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"statements": [
{
"sql": "<string>",
"params": [
{}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/axons/{id}/sql/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'statements' => [
[
'sql' => '<string>',
'params' => [
[
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/axons/{id}/sql/batch"
payload := strings.NewReader("{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/v1/axons/{id}/sql/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/axons/{id}/sql/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"success": {
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"rows": [
{}
],
"meta": {
"duration_ms": 123,
"changes": 123,
"rows_read_limit_reached": true
}
},
"error": {
"message": "<string>"
}
}
]
}axons
[Beta] Execute a batch of SQL statements against an axon's database.
[Beta] Execute multiple SQL statements atomically within a single transaction against an axon’s SQLite database.
POST
/
v1
/
axons
/
{id}
/
sql
/
batch
JavaScript
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const sqlBatchResultView = await client.axons.sql.batch('id', { statements: [{ sql: 'sql' }] });
console.log(sqlBatchResultView.results);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
sql_batch_result_view = client.axons.sql.batch(
id="id",
statements=[{
"sql": "sql"
}],
)
print(sql_batch_result_view.results)curl --request POST \
--url https://api.runloop.ai/v1/axons/{id}/sql/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"statements": [
{
"sql": "<string>",
"params": [
{}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/axons/{id}/sql/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'statements' => [
[
'sql' => '<string>',
'params' => [
[
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/axons/{id}/sql/batch"
payload := strings.NewReader("{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/v1/axons/{id}/sql/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/axons/{id}/sql/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"statements\": [\n {\n \"sql\": \"<string>\",\n \"params\": [\n {}\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"success": {
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"rows": [
{}
],
"meta": {
"duration_ms": 123,
"changes": 123,
"rows_read_limit_reached": true
}
},
"error": {
"message": "<string>"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The axon identifier.
Body
application/json
The SQL statements to execute atomically within a transaction.
Show child attributes
Show child attributes
Response
200 - application/json
OK
One result per statement, in order.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
